package com.fy.controller;

import com.fy.dao.MuseumMapper;
import com.fy.entity.Museum;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

@RestController
@RequestMapping("/museum")
public class MuseumController {
    String id = "1";
    @Resource
    MuseumMapper museumMapper;

    @GetMapping("/getAll")
    public List<Museum> getAll() {
        return museumMapper.findAll();
    }

    @PostMapping("/insert")
    public String insert(String mus_id, String mu_id) {
        museumMapper.insert(id, mu_id);
        id = (Integer.valueOf(id) + 1 + "");
        return "200";//创建成功
    }
}
